package Tetris;

import java.awt.event.KeyEvent;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;

public class Keygether {

	public static HashMap<String, Integer> keys;
	
	public static ArrayList<String> keyNames;
	
	public static void loadkey(){
		keys= new HashMap<String, Integer>();
		keyNames= new ArrayList<String>();
		Field[] field=KeyEvent.class.getFields();
		for(Field f: field){
			if(Modifier.isStatic(f.getModifiers())){
				//System.out.println(f);
				if(f.getName().startsWith("VK")){
					//System.out.println(f);
					try{
						int num=f.getInt(null);
						String name = KeyEvent.getKeyText(num);
						keys.put(name, num);
						//System.out.println(name);
						keyNames.add(name);
					}
					catch(Exception e){
						e.printStackTrace();
					}
				}
			}
		}
	}
}
